import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'

export default defineConfig({
    plugins: [
        vue(),
        vueJsx()
    ],
    // 已存在的CORS配置
    server: {
        headers: {
            'Access-Control-Allow-Origin': '*',
            'Access-Control-Allow-Methods': 'GET,POST,PUT,PATCH,OPTIONS',
            'Access-Control-Allow-Headers': 'Origin, Content-Type, Accept'
        }
    },
    preview: {
        headers: {
            'Access-Control-Allow-Origin': '*',
            'Access-Control-Allow-Methods': 'GET,POST,PUT,PATCH,OPTIONS',
            'Access-Control-Allow-Headers': 'Origin, Content-Type, Accept'
        }
    },

    // 已存在的file协议支持配置
    base: './',
    build: {
        assetsDir: '',
        // rollupOptions: {
        //     output: {
        //         entryFileNames: '[name].js',
        //         chunkFileNames: '[name].js',
        //         assetFileNames: '[name].[ext]'
        //     }
        // },
        cssCodeSplit: false
    }
})